package com.ujiuye.controller;

import com.ujiuye.bean.Users;
import com.ujiuye.service.UsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@Controller
public class UsersController {

    @Autowired
    UsersService usersService;

    //查询
    @RequestMapping(value = "/getUsersList.action")
    public ModelAndView getUsersList() {
        List<Users> usersList = usersService.getUsersList();
        for (Users u : usersList) {
            System.out.println(u);
        }
        ModelAndView mav = new ModelAndView();
        mav.setViewName("userlist");
        mav.addObject("userlist", usersList);
        return mav;
    }

}
